package com.qidian.mes.md.controller;

import com.qidian.mes.md.service.MdWorkshopService;
import com.qidian.mes.pojo.MdWorkshop;
import com.qidian.mes.util.pojo.QdResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: 小可怎么都睡不够
 * @Description:
 * @Time: 2024-04-10 11:13
 **/

@RestController
@RequestMapping("/workshop")
@CrossOrigin
public class MdWorkshopController {

    @Autowired
    MdWorkshopService mdWorkshopService;


    @GetMapping("/{id}")
    public QdResult getMdWorkshopById(@PathVariable(value = "id") Integer idWorkshop) {
        return mdWorkshopService.getMdWorkshopById(idWorkshop);
    }
    @GetMapping("/count")
    public QdResult getCount() {
        return mdWorkshopService.getCount();
    }
    @PostMapping("/add")
    public QdResult insertMdWorkshop(@RequestBody String data) {
        return mdWorkshopService.insertMdWorkshop(data);
    }
    @DeleteMapping("/{id}/{status}")
    public QdResult deleteMdWorkshopById(@PathVariable(value = "id") Integer idWorkshop,@PathVariable(value = "status")Integer status) {
        return mdWorkshopService.deleteMdWorkshopById(idWorkshop,status);
    }
    @PutMapping("/update")
    public QdResult updateMdWorkshop(@RequestBody String data) {
        return mdWorkshopService.updateMdWorkshop(data);
    }

    @GetMapping("/query")
    public QdResult getMdWorkshopsByName(@RequestParam String emp,@RequestParam String name,@RequestParam Integer page,@RequestParam Integer limit) {
        return mdWorkshopService.getMdWorkshopsByName(emp, name, page, limit);
    }

    @GetMapping("/queryAll")
    public QdResult getMdWorkshops() {
        return mdWorkshopService.getMdWorkshops();
    }


}
